<div class="layui-card-body" >
    <table class="layui-table text-center" id="categorylist" lay-filter="categorylist"
           list-url="{:url('getcategory?project_id='.$project_id.'&model_id='.$model_id)}"
           edit-url="{:url('editcategory?project_id='.$project_id.'&model_id='.$model_id)}"
           del-url="{:url('delcategory?project_id='.$project_id.'&model_id='.$model_id)}"
           addcategory-url="{:url('addcategory?project_id='.$project_id.'&model_id='.$model_id)}"></table>
    <form class="layui-form" action="{:url('category?project_id='.$project_id.'&model_id='.$model_id)}"
         method="post">
    </form>
</div>
<script type="text/html" id="categorybarDemo">
    <a class="layui-btn  layui-btn-xs" lay-event="addcategory"><i class="fa fa-laptop"></i>添加</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"> <i class="fa fa-trash-o"></i> 删除</a>
</script>

<script type="text/javascript">
    layui.use(['form', 'layer', 'table'], function () {
        var form = layui.form
            , table = layui.table
            , $ = layui.$
            , data = [];
        table.render({
            elem: '#categorylist'
            , url: "{:url('getcategory?project_id='.$project_id.'&model_id='.$model_id)}"
            , loading: true
            , page: false
            ,limit:20
            , cols: [[
                 {field: 'title', title: '分类名称', templet: '<div>{{d.html}}{{d.title}}</div>', edit: 'text'}
                , {fixed: 'right', width: 130, title: '操作', toolbar: '#categorybarDemo'}
            ]]
        });
        table.reload('#categorylist', {
            url: "{:url('getcategory?project_id='.$project_id.'&model_id='.$model_id)}"
            , page: false
            , where: {} //设定异步数据接口的额外参数
            //,height: 300
        });

    });
</script>






